class Solution {
public:
    int countBalls(int lowLimit, int highLimit)
    {
        unordered_map<int, int> mp;
        int ans = INT_MIN;
        for (int i = lowLimit; i <= highLimit; i++)
        {
            string s = to_string(i);
            int cnt = 0;
            for (auto e : s) cnt += e - '0';
            ans = max(ans, ++mp[cnt]);
        }
        return ans;
    }
};